﻿// 1.1.6.16. Write a program that by given number "N" prints all numbers from 1 to "N" in random order.

using System;

class PrintingInRandomOrder
{
    static void Main()
    {
        int userInput = int.Parse(Console.ReadLine());  // declaring "N"
        int[] randomOrdered = new int[userInput];   // declaring an array
        bool uniqueNumber = true;   // a beautiful bool variable which helps a lot :)
        Random randomGenerator = new Random();  // declaring a Random object with which we add the function to generate random numbers in chosen scope

        for (int arrElement = 0; arrElement < userInput - 1; arrElement++)  // this is the loop with which we manage the array's elements
        {
            
            for (long k = 0; k < long.MaxValue; k++)    // with this loop we ensure there will be enough times for the random generator to generate an unique(non-existing) number
            {
                randomOrdered[userInput - 1] = randomGenerator.Next(1, userInput);  // we interact with the random object generating and number in a scope and set it in the last unusable array element
                for (int j = 0; j <= randomOrdered.Length - 2; j++) // this loop calls out all usuable elements
                {
                    if (randomOrdered[j] == randomOrdered[userInput - 1])   // comparing the current arr element with the random generated number
                    {
                        uniqueNumber = false;   // we mark that there is an existing element in the array which is the same with the random generated one                       
                    }
                }
                if (uniqueNumber)   // if the random generated number is unique and still there is no match in the array we declare it and brake the loop because we dont need any more random numbers for the current array element
                {
                    randomOrdered[arrElement] = randomOrdered[userInput - 1];
                    break;
                }
                uniqueNumber = true;    // reseting the bool value so the comparison check continues
            }
        }

        for (int arrElementIndexator = 0; arrElementIndexator <= randomOrdered.Length - 2; arrElementIndexator++)   // selecting consecutively each usable element
        {
            Console.WriteLine(randomOrdered[arrElementIndexator]);    // printing the selected element
        }
    }
}